package com.zh.note.huawei.onehundred.洞穴探险or最远足迹;

/**
 * @Author: zhanghuan
 * @date: 2023/9/2 17:52
 * @description: create it
 */

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        try (Scanner s = new Scanner(System.in)) {
            String history = s.nextLine();
            Set<Integer> calculatedValues = new HashSet<>();
            int index = 0, x = 0, y = 0, max = 0, l = -1, r = -1;

            for (; r < history.length() - 1; index = r + 1) {
                l = history.indexOf("(", r == -1 ? index : r);
                r = history.indexOf(")", l);
                int commaIndex = history.indexOf(",", l);
                int a = Integer.parseInt(history.substring(l + 1, commaIndex));
                int b = Integer.parseInt(history.substring(commaIndex + 1, r));

                if (a != 0 && b != 0) {
                    int len = a * a + b * b;
                    if (max < len && !calculatedValues.contains(len)) {
                        max = len;
                        x = a;
                        y = b;
                    }
                    calculatedValues.add(len);
                }
            }
            System.out.printf("(%d,%d)", x, y);
        }
    }
}

